package fctuc.dei.myTwitter.server;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import fctuc.dei.myTwitter.com.RMIClientListener;
import fctuc.dei.myTwitter.com.RMIServer;

public class RMIServerImpl implements RMIServer {
	MyTwitterServer server;

    public RMIServerImpl(MyTwitterServer svr) throws RemoteException {
        UnicastRemoteObject.exportObject(this);
        server = svr;
    }

    public RMIServerConnectionImpl connect(RMIClientListener callerListener)
        throws RemoteException {

        System.err.println("<<< Incoming RMI connection.\n");
        return new RMIServerConnectionImpl(server, callerListener);
    } 
}
